home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Sapphire Collection / Software Vault (Sapphire Collection) (Digital Impact).ISO / cdr47 / trace122.zip / TRACE.DOC next >
Text File  |  1987-02-13  |  10KB  |  211 lines

  1.                      TRACE - Interrupt Tracer version 1.22 
  2.  
  3.                           Written by Joan Riff for:
  4.                      Computerwise Consulting Services 
  5.  
  6.                  P.O. Box 813, McLean VA 22101  (703) 280-2809
  7.  
  8.                Documented and Enhanced By A. B. Krueger 
  9.  
  10.         Contact: ARNY KRUEGER at the EXEC-PC BBS in Shorewood Wisconson.
  11.                                   414-964-5160
  12.  
  13.  
  14. TRACE is a TSR program that traces interupts.
  15.  
  16.                 It:
  17.  
  18.                  * traps interrupt's
  19.                  * traces the registers at the entry to the interrupt, 
  20.                  * executes the interrupt itself
  21.                  * optionally traces the registers at exit from the interrupt. 
  22.  
  23. TRACE also allows the user at the keyboard to display  this traced 
  24. information, either on the screen or at the printer. 
  25.  
  26. The interrupts that are to be TRACEd are specified in the ICT table in 
  27. the source code. Once defined, they may be enabled or disabled from the 
  28. keyboard.  A default ICT is provided and you should not modify it until 
  29. you understand how TRACE is used and how it works.  
  30.  
  31.       <<< REBOOT AS SOON AS POSSIBLE AFTER INVOKING TRACE!!! >>>
  32.  
  33. TRACE is not foolproof or bugfree. Use it as a tool for finding out what 
  34. DOS and DOS programs do. USE IT AT YOUR OWN RISK.  When you have a print 
  35. out of the trace activity that interests you, reboot your system.  It may 
  36. not be long for this world! Don't say that you weren't warned.  
  37.  
  38.  
  39.       Usage is: TRACE [size]  
  40.  
  41.           where: size is the size of the trace table in K
  42.                  between 10 and 53, default is 30
  43.  
  44.  
  45. Known problems:
  46.  
  47.    *   Programs that use:  INT 21h function E0h. Trace uses it for
  48.        avoiding repeated installation within a single booted session.
  49.  
  50.    *   Programs that use INT 2Eh. They mess with DOS's mind anyway.
  51.  
  52.    *   Keyboard ICT control for ICT's 7-15 isn't there. I added ICT's
  53.        7-15 to make TRACE stable, but it will take some major work to
  54.        get them to be keyboard controllable. Send mail if you need this
  55.        feature - I would never use it.
  56.  
  57.    *   Print spoolers. TRACE does OUT's to the Parallel port as well
  58.        as the more usual BIOS INT 17's.
  59.  
  60.  
  61. How it works:
  62.  
  63.    TRACE initialization code is in TRACE12.ASM.  At initialization, TRACE 
  64.    initializes its Interrupt Control Table (ICT).  The ICT contains one 
  65.    element for every interrupt number or subset thereof to be traced. 
  66.  
  67.    Tracing control within a given interrupt number is determined by the 
  68.    value of AH. Interrupts vary as to whether they return to the caller, 
  69.    or not. INT 20 (program exit) is an example of an interrupt that does 
  70.    not return to the caller. Treatment of the 808x flags at return also 
  71.    varies, and is controlled by the ICT. DOS INT 21 function 25 is used 
  72.    to route interrupts to TRACE entry points.  
  73.  
  74.    The ICT entries are laid out in TRACE1E.AIC, and defined in 
  75.    TRACE1.ASM.  Further documentation about  ICT's is located there, for 
  76.    easy reference.  There are 16 possible different ICT entries. The 
  77.    first 12 are used, leaving 4 for future expansion. The first 12 are 
  78.    not sacrosanct, but an entry covering INT 21H  0D0h < AH < 0FFh is 
  79.    recommended. TRACE traps  INT 21h to protect itself against being 
  80.    loaded twice.  
  81.  
  82.    TRACE allocates a trace table in accordance with the calling 
  83.    parameter. If none is provided, 30K is used as a default. The trace 
  84.    table size is forced to be between 10K and 64K. If below 10K, the 
  85.    table would be smaller than the program that controls it, which makes 
  86.    little sense. The 64K limit comes from the 808x segment size. 
  87.  
  88.    When a interrupt to be TRACEd takes place, TRACE stores register and 
  89.    flag information in the trace table, with a header that tells what 
  90.    kind of interrupt trace entry this is. If post-interrupt tracing is 
  91.    requested, then some carry-forward information is placed on the stack, 
  92.    and control is passed to the interrupt handler that was in place when 
  93.    TRACE was initialized. After the original interrupt handler returns, 
  94.    TRACE stores stores register and flag information in the trace table, 
  95.    with a header that tells what kind of interrupt trace entry this is. 
  96.    If the interrupt table is full, tracing ends. 
  97.  
  98.    When TRACE is entered via Shift-PrtSC, or from Periscope via INT 60h, 
  99.    TRACE's command processor prompts for output and trace control 
  100.    commands, which are single letters. One important command is "Q" for 
  101.    QUIT, which returns control to DOS. The Output routing options are 
  102.    printer or screen. Print output enables displaying TRACE data without 
  103.    affecting the screen's display, as well as making hard-copy for 
  104.    reference. The enable and disable options allow the status of 
  105.    individual ICT's to be altered. 
  106.  
  107.  
  108.       Command Summary - enter via Shift-PrtSc:
  109.  
  110.       C        Clears the trace table and ICT count fields.  
  111.       L        Lists the ICT status, include INT counts. 
  112.       P        Causes Trace output, including command mode menus,
  113.                to go to the printer
  114.       S        Causes Trace to use Screen output (Default)
  115.       T        Lists the trace, or selected data, by ICT number. 
  116.       W        Calls the old Prt-Sc handler.
  117.  
  118.    The ICT for INT 21h subfunctions 00-09 are usually disabled because 
  119.    there is a lot of uninformative action in this range, for keyboard and 
  120.    screen I/O. It would not be too wise to try to trace INT 5h, 10h and 
  121.    17h, as they are used by TRACE. 
  122.  
  123.  
  124. How and Why to Modify TRACE:
  125.  
  126.    When TRACE displays trace table data, it is formatted and self-
  127.    explanitory. You may not like my explanations, or want to add some 
  128.    more. 
  129.  
  130.    Each known interrupt is tagged with identifying text, and the register 
  131.    and flag contents are labeled and described. Tables in TRACE1.AIC 
  132.    control this for interrupts 13H and 21h.  TRACE11.ASM contains most of 
  133.    the formatting subroutines and secondary tables. 
  134.  
  135.    Note that TRACE11 contains a PRINT_EDIT subroutine that is capable of 
  136.    sophisticated output formatting using flag bytes EDIT_xxxx, which are 
  137.    defined in TRACE1E.AIC.  
  138.  
  139.    TRACE1E.AIC changes can affect all three .ASM files. If you change 
  140.    TRACE1E, figure on re-assembling TRACE1, TRACE11, and  TRACE12.  
  141.    Normally, updating the TRACE1 ICT definitions necessitates re-
  142.    assembling only TRACE1. Link TRACE using the command: 
  143.  
  144.                LINK TRACE1+TRACE11+TRACE12,TRACE;
  145.  
  146.    Convert TRACE to a COM file using:
  147.  
  148.                EXE2BIN TRACE.EXE TRACE.COM
  149.  
  150.  
  151. How to use TRACE:
  152.  
  153.    Initialize TRACE using the command:
  154.  
  155.                     TRACE
  156.  
  157.    If TRACE is already in place it will type an error message, but no 
  158.    harm will be done. Errorlevel 10 will be set if it is already in 
  159.    place. 
  160.  
  161.    When you TRACE, we encourage you to use the Shift-PrtSc key to 
  162.    interrupt the opeation of complex programs, and clear the trace table 
  163.    so that the contents of the trace table are relevant to your study. 
  164.    Some programs trap INT 5, and will keep you from getting into TRACE 
  165.    using Shift-PrtSc, until they complete. Trace uses the PrtSc anti-
  166.    recursion byte at 500h. Any program that sets this byte to 1 will keep 
  167.    Trace from going into command mode. 
  168.  
  169.    TRACE has been upgraded to be fairly stable. In its original form 
  170.    Interuupts 20h, 27h, 21h with AH=31h and 21h with AH=4Ch would cause 
  171.    it to crash often.  It is your responsibility to alter the operational 
  172.    environment or modify TRACE to stay intact through the operation you 
  173.    are TRACing.  
  174.  
  175.    TRACE will impact the performance of  your PC when it is running, 
  176.    especially if the trace table is not yet full. 
  177.    
  178.    TRACE provides a means for understanding the control and flow of 
  179.    programs like DOS itself, for which you have no source code or 
  180.    internals documentation. One trick is to use TRACE  CS:IP values to 
  181.    get a IP value that you subsequently use with DEBUG to trace the area 
  182.    of interest.  
  183.  
  184.    Trace information can also be used to find out which program code 
  185.    inspects or updates specific parts of a disk that are known to contain 
  186.    information of interest.  You may have to work back from an INT 13 or 
  187.    INT 24 entry to do this.  You will have to identify the location on 
  188.    disk by drive, side, track, and sector number. There are several disk 
  189.    utilities that will help you do this such as NORTON's utilities, IBM's 
  190.    DiskRepair, or Central Point's PC TOOLs.  
  191.  
  192.    When running TRACE, you may notice a large number of DOS INT 21h AH=3E
  193.    calls as DOS closes file handles 5-19 once per keyboard or .BAT file 
  194.    command.  If this bothers you, you can modify the ICT table to disable 
  195.    TRACEing this interrupt. Note that there is one pass through TRACE's 
  196.    interrupt handlers for every different range of AH you define in the 
  197.    ICT's, until the correct ICT is found. 
  198.  
  199.    Any insights about TRACE that you route to the author will be 
  200.    appreciated! Contact ARNY KRUEGER at the EXEC-PC BBS (414-964-5160), 
  201.    or daytime voice phone 313-583-9610.  
  202.  
  203.  
  204. Trace update history:
  205.  
  206.     1.21 1/26/87  - first released modified version
  207.  
  208.     1.22 2/13/87  - Corrected trace table size option processing
  209.                   - re-instated PrtSc function via main menu
  210.  
  211.